import { FilterConst } from "../../../../component/gconst/FilterConst";
import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { Cache } from "../../../cache/Cache";
import { MagicTowerConfig } from "../../../resource/MagicTowerConfig";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { Language } from "../../../../../extend/language/Language";
//class TowerPassRewardsPanel
    
    export  class TowerPassRewardsPanel /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.mouseEnabled = false;
            this.mouseChildren = false;
            this.createChildren();
            return;
        }

        /* internal  */createChildren(): void
        {
            this._bg = new Object /* flash.display.Bitmap */(new Object /* flash.display.BitmapData */(226, 200, false, 0));
            this._bg.alpha = 0.45;
            this.addChild(this._bg);
            this._infoText = new Object /* flash.text.TextField */();
            this._infoText.y = 10;
            this._infoText.width = 226;
            this._infoText.height = 200;
            this._infoText.wordWrap = true;
            this._infoText.filters = [FilterConst.glowFilter];
            this._infoText.defaultTextFormat = new GTextFormat(FontUtil.songtiName, 12, GlobalStyle.color1Uint, null, null, null, null, null, null, 10, 10, null, 5);
            this.addChild(this._infoText);
            this.updateInfos();
            return;
        }

        public updateInfos(): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            if (Cache.instance.copy.magicTowerInfo) 
            {
                loc1 = Cache.instance.copy.magicTowerInfo;
                loc2 = MagicTowerConfig.instance.getInfoByFloor(loc1.floor);
                if (!loc2) 
                {
                    return;
                }
                loc3 = "";
                loc3 = loc3 + (HTMLUtil.addColor(Language.getString(60082), "#DBAA65") + HTMLUtil.addColor("" + loc2.rewardExp, "#4CCB4A"));
                if (loc1.expRate > 100) 
                {
                    loc3 = loc3 + HTMLUtil.addColor(" +" + int(loc2.rewardExp * (loc1.expRate - 100) / 100), "#4CCB4A");
                }
                loc3 = loc3 + "\n";
                loc3 = loc3 + (HTMLUtil.addColor(Language.getString(60083), "#DBAA65") + HTMLUtil.addColor("" + loc1.totalExp, "#4CCB4A"));
                if (loc1.expRate > 100) 
                {
                    loc3 = loc3 + HTMLUtil.addColor(" +" + int(loc1.totalExp * (loc1.expRate - 100) / 100), "#4CCB4A");
                }
                this._infoText.htmlText = loc3;
            }
            return;
        }

        /* internal */ /* var */_bg: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_infoText: Object /* flash.text.TextField */;
    }
